package BTTL06;

public class Command implements CommandItf{

	@Override
	public Phanso tong(Phanso ps1, Phanso ps2) {
		Phanso kq = new Phanso();
		kq.settu(ps1.gettu()*ps2.getmau() + ps1.getmau()*ps2.gettu());
		kq.setmau(ps1.getmau()*ps2.getmau());
		kq.rutgon();
		return kq;
	}

	@Override
	public Phanso hieu(Phanso ps1, Phanso ps2) {
		Phanso kq = new Phanso();
		kq.settu(ps1.gettu()*ps2.getmau() - ps1.getmau()*ps2.gettu());
		kq.setmau(ps1.getmau()*ps2.getmau());
		kq.rutgon();
		return kq;
	}

	@Override
	public Phanso tich(Phanso ps1, Phanso ps2) {
		Phanso kq = new Phanso();
		kq.settu(ps1.gettu()*ps2.gettu());
		kq.setmau(ps1.getmau()*ps2.getmau());
		kq.rutgon();
		return kq;
	}

	@Override
	public Phanso thuong(Phanso ps1, Phanso ps2) {
		Phanso kq = new Phanso();
		kq.settu(ps1.gettu()*ps2.getmau());
		kq.setmau(ps1.getmau()*ps2.gettu());
		kq.rutgon();
		return kq;
	}

}
